import { _decorator, Component, Input, input, Node } from "cc";
import { GameManager } from "../GameManager";
const { ccclass, property } = _decorator;

@ccclass("GameReadyUI")
export class GameReadyUI extends Component {
  protected onLoad() {
    input.on(Input.EventType.TOUCH_START, this.startGame, this);
  }
  start() {}

  update(deltaTime: number) {}

  protected onDestroy(): void {
    input.off(Input.EventType.TOUCH_START, this.startGame, this);
  }

  public startGame() {
    GameManager.getInstance().switchPlay();
  }

  public show() {
    this.node.active = true;
  }

  public hide() {
    this.node.active = false;
  }
}
